package com.immac.leejc.randomaccess;

import java.io.IOException;

public class Main {
	public static void main(String[] args) throws InterruptedException, IOException {
		RandomAccessProcess rap = new RandomAccessProcess("text/random.txt", "rw");
		
		for (int i = 0; i < 100; i++) {
			rap.write(i, (byte)i);
		}
		
		rap.close();
		
		rap = new RandomAccessProcess("text/random.txt", "rw");
		int offset = 50;
		byte readData = rap.readByte(offset);
		
		System.out.println(readData);
		rap.write(offset, readData * 2);
		
		System.out.println(rap.readByte(offset));
		
		rap.close();
	}
}
